#ifndef H_YS_TIMER_
#define H_YS_TIMER_

#ifndef WIN32
#include <ctime>

namespace n_ysUtil{
class ysTimer
{
public:
	ysTimer(){ ; }

	void Start() { clk_ = std::clock(); }

	// return by second(s)
	double Tick(){
		return ((std::clock() - clk_) / (double)(CLOCKS_PER_SEC));
	}

private:
	std::clock_t clk_;
	
};

}//namespace

#else //def WIN32
#include <windows.h>

namespace n_ysUtil{
class ysTimer
{
public:
	ysTimer(){ QueryPerformanceFrequency(&sysFreq_); }
	
	void Start() { QueryPerformanceCounter(&counter0_); }

	// return by second(s)
	double Tick(){
		QueryPerformanceCounter(&counter1_);
		return ((counter1_.QuadPart - counter0_.QuadPart) / (double)(sysFreq_.QuadPart));
	}
	

private:
	LARGE_INTEGER counter0_;
	LARGE_INTEGER counter1_;
	LARGE_INTEGER sysFreq_;
};
}//namespace

#endif //def WIN32

#endif //header

